-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance tap event for web accessibility #178
base: master
Are you sure you want to change the base?
Conversation
src/core.js
Outdated
condition: function(event, custom){ | ||
if (event.type == 'pointerdown') { | ||
custom.startX = event.clientX; | ||
custom.startY = event.clientY; | ||
} | ||
else if (event.type == 'keypress') { | ||
if (event.which == 13 || event.which == 32) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider simplifying to: return event.which == 13 || event.which == 32;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, great suggestion.
KeyboardEvent.which is now deprecated. May want to switch to `event.key`,
or use in addition to `event.which`.
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/which
…On Thu, Aug 24, 2017 at 9:25 AM, JustinCreasy ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/core.js
<#178 (comment)>:
> condition: function(event, custom){
if (event.type == 'pointerdown') {
custom.startX = event.clientX;
custom.startY = event.clientY;
}
+ else if (event.type == 'keypress') {
+ if (event.which == 13 || event.which == 32) {
thanks, great suggestion.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#178 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AQpkk5OQapO36EKDlmLhia3R7EgBFLiVks5sbXnTgaJpZM4O7tCF>
.
|
Per @jpecor-pmi's correct assertion about the deprecation of Also, can you do the same thing in the core-2 repo when we release the alpha this week? |
That works, I'll get either event.which or event.key worked in there. A bit swamped at work at the moment but hopefully soon. I can definitely make the updates again on core-2. |
It looks like |
ok, I have switched to KeyboardEvent.key, as suggested by @jpecor-pmi I'm a bit concerned because while KeyboardEvent.which is deprecated it has much better support in older browsers than KeyboardEvent.key ( according to http://caniuse.com ). When I get a chance I'll try to test things on a virtual machine running a browser like Chrome v49 to see if I can work up a solution that uses both. |
The tap event as it works now is not fully accessible. This PR add a keypress check for the enter key and the spacebar and treats them as tap events as well.